package com.i72.penetrate.init;

import com.i72.basic.context.GlobalContext;
import com.i72.basic.enums.RPCProtocolEnum;
import org.springframework.context.annotation.DeferredImportSelector;
import org.springframework.core.type.AnnotationMetadata;

import java.util.ArrayList;
import java.util.List;


public class PenetrateConfigurationInit implements DeferredImportSelector {

    @Override
    public String[] selectImports(AnnotationMetadata importingClassMetadata) {

        List<String> beans = new ArrayList<>();


        if(GlobalContext.getProtocol().equals(RPCProtocolEnum.HTTP.name())){
            //bean = new String[]{"com.i72.penetrate.init.PenetrateConfiguration1"};
            beans.add("com.i72.penetrate.init.PenetrateConfiguration1");
        }else {
            //bean = new String[]{"com.i72.penetrate.init.PenetrateConfiguration2"};
            beans.add("com.i72.penetrate.init.PenetrateConfiguration2");
        }
        beans.add("com.i72.penetrate.init.RPCInit");
        beans.add("com.i72.penetrate.init.TouchInit");
        String [] bean = new String[beans.size()];
        return beans.toArray(bean);

    }


}
